package agricultural;

import strategy.WorkStrategy;
import strategy.impl.AdjustedPlantingStrategy;
import strategy.impl.DelayPlantingStrategy;
import strategy.impl.NormalPlantingStrategy;

public class Planter extends AgriculturalMachine {
    public Planter(String machineId) {
        super(machineId);
        this.workStrategy = new NormalPlantingStrategy();
    }

    @Override
    public void adjustToEnvironment(double soilMoisture, int cropGrowthStatus, String weatherData) {
        System.out.println(machineId + "收到环境数据更新通知");
        if (soilMoisture > 80) {
            setWorkStrategy(new DelayPlantingStrategy());
        } else if (soilMoisture > 60) {
            setWorkStrategy(new AdjustedPlantingStrategy());
        } else {
            setWorkStrategy(new NormalPlantingStrategy());
        }
        performWork();
    }

    @Override
    public void update(double soilMoisture, int cropGrowthStatus, String weatherData) {

    }
}